package com.beordie.version_2.aop.interceptor;

import com.beordie.version_2.aop.aspect.BODAbstractAspectJAdvice;
import com.beordie.version_2.aop.config.BODJoinPoint;

import java.lang.reflect.Method;

/**
 * @Description
 * @Date 2022/2/22 15:14
 * @Created 30500
 */
public class BODThrowingAdviceInterceptor extends BODAbstractAspectJAdvice implements BODMethodInterceptor{
    /**
     * 异常类型
     */
    private String throwName;
    public BODThrowingAdviceInterceptor(Object newInstance, Method method) {
        super(newInstance, method);
    }

    @Override
    public Object invoke(BODMethodInvocation invocation) throws Throwable {
        try {
            return invocation.procced();
        }catch (Throwable ex) {
            invokeAdviceMethod(invocation, null, ex);
            throw ex;
        }
    }

    public void setThrowName(String aspectAfterThrowingName) {
        this.throwName = aspectAfterThrowingName;
    }
}
